var admissionTab = new Array();

function BlindDown(element)
{
   new Effect.BlindDown(element, 
   {duration:1, from:0, to:1.0});
}
function BlindUp(element)
{
   new Effect.BlindUp(element, 
   { duration:0.5});
}
function toogleTab(type,pro_id)
{
    BlindDown(type + pro_id.toString());    
}

function loadPartner()
{
    pro_menu_id = $('programmes').value;
    if (pro_menu_id !=-1)
    {
        $('partners').value = -1;        
        callAJAX("xoad_handler","loadPartner",$H({pro_menu_id: pro_menu_id}),loadPartner_callback);
    }
}
function loadPartner_callback(result)
{
    if (result!="OK")
    {
        alert(result);
    }
}

function viewAdmissionContent()
{
    pro_menu_id = $('programmes').value;
    partner_id = $('partners').value;
    if (pro_menu_id ==-1)
    {
        alert("You must select programme first!");
    }
    else if (partner_id ==-1)
    {
        alert("Please select partner!");
    }
    else
    {
        callAJAX("xoad_handler","loadPageContent",$H({pro_menu_id: pro_menu_id, partner_id: partner_id,type: $('admission_type').value}),loadPageContent_callback);
    }
}
function loadPageContent_callback(result)
{
    if (result!="OK")
    {
        alert(result);
    }
}

function downloadForm()
{
    if ($('admission_type').value==3)
    {
        partner_id = $('partners').value;
        if (partner_id !=-1)
        {
            pro_menu_id = $('programmes').value;
            callAJAX("xoad_handler","downloadForm",$H({pro_menu_id: pro_menu_id, partner_id: partner_id}),downloadForm_callback);
        }
    }
}

function downloadFile()
{
	location.href = $('file_url').value;
}

function downloadForm_callback(result)
{
    if (result!="OK")
    {
        alert(result);
    }
}